/*
CUNY - GMapper
Software Design Lab
CSC 22100 - Spring 2011

TEAM 9:
Ariel Teferici
Ivan Tse
Michael Cheong

SVN Repository:
http://code.google.com/p/cuny-gmapper/
 */
package com.macavelly.com;

import java.io.IOException;
import java.util.List;
import java.util.Locale;

import com.google.android.maps.GeoPoint;

import android.content.Context;
import android.location.Address;
import android.location.Geocoder;
import android.text.Editable;

public class revgeocode {
	private Context gContext;
	private List<Address> geoloc;
	private String add;
	
	public revgeocode (GeoPoint addy, Context context){
		gContext = context;
		Geocoder revgeocodeaddy = new Geocoder(gContext, Locale.US);
		try {
			double lat = addy.getLatitudeE6()/1000000;
			double lon = addy.getLongitudeE6()/1000000;
			geoloc = revgeocodeaddy.getFromLocation(lat,lon,5);
			Address x = geoloc.get(0);
			add = x.getAddressLine(0) + ", " + x.getLocality();;
			
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	public String getrevAddy(){
		return add;

	}

}
